<!DOCTYPE html>
<html class="ui-page-login">
<head>
    <meta charset="utf-8"/>
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
    <title></title>
    <script src="__PUBLIC__/js/jquery.min.js"></script>
    <script src="__PUBLIC__/js/angular.js"></script>
    <script src="__PUBLIC__/home/plugins/layer/layer.js"></script>
    <script src="__PUBLIC__/mui/js/mui.min.js"></script>
    <link rel="stylesheet" href="__PUBLIC__/mui/css/mui.css"/>
    <!--App自定义的css-->
    <link rel="stylesheet" href="__PUBLIC__/css/app.css"/>
    <link rel="stylesheet" href="__PUBLIC__/css/cart.css"/>
    <script src="__PUBLIC__/common.js"></script>
    <style>
        .mui-input-row .mui-input {
            text-align: right;
            padding-right: 1em;
        }

        .mui-input-row label {
            color: #333333;
            font-family: "Microsoft YaHei UI";
            font-size: 14px;
            letter-spacing: 1px;
        }

        .mui-input-row label {
            width: 28%;
        }
    </style>
    <link rel="stylesheet" href="__PUBLIC__/js/nice-validator-0.10.11/dist/jquery.validator.css"/>
    <script src="__PUBLIC__/js/nice-validator-0.10.11/dist/jquery.validator.js"></script>
    <script src="__PUBLIC__/js/nice-validator-0.10.11/dist/local/zh-CN.js"></script>
</head>
<body ng-app="myApp" ng-controller="Ctrl" ng-cloak>
<header class="mui-bar mui-bar-nav" style="background:#f3363a;">
    <a class="mui-icon mui-icon-left-nav mui-pull-left" style="color: white" href="/index.php/home/agen/member"></a>
    <!--  <a class="mui-icon  mui-pull-right toggle" style="color: white;font-size: 14px;line-height: 44px;margin: 0;padding: 0">代理登录</a>-->
    <h1 class="mui-title login-item" style="color: white">个人信息</h1>
</header>
<div style="height: 44px"></div>
<div class="mui-page-content">
    <form class="mui-input-group" method="post" action="" style="margin-top: 0;  background: #efeff4;"
          data-validator-option="{stopOnError:false, timely:true,theme:'layer'}">
        <div class="mui-input-group">
            <div style="height: 10px;background: #efeff4;"></div>
            <div class="mui-input-row">
                <label>账号:</label>
                <input name="account" type="text" class=" mui-input" ng-value="message.account" readonly
                       style="color: gray;"/>
            </div>
            <div class="mui-input-row">
                <label>等级:</label>
                <input name="level" type="text" class="mui-input" ng-value="message.level" readonly
                       style="color: gray;"/>
            </div>
            <div class="mui-input-row enter">
                <label style="width: 40%;">可提现金额:</label>
                <input name="upagenaccount" type="text" class="mui-input" ng-value="message.balance" readonly
                       style="color: gray;width: 60%;"/>
            </div>

            <div style="height: 10px;background: #efeff4;"></div>

            <div class="mui-input-row">
                <label>姓名:</label>
                <input name="name" type="text" class=" mui-input" data-rule="required;" ng-model="message.name"/>
            </div>
            <div class="mui-input-row">
                <label>身份证:</label>
                <input name="idcard" type="text" class="mui-input" ng-value="message.idcard" readonly
                       style="color: gray;"/>
            </div>
            <div class="mui-input-row">
                <label>手机:</label>
                <input name="phone" type="text" class="clear mui-input" data-rule="required;mobile"
                       ng-model="message.phone"/>
            </div>
            <div class="mui-input-row">
                <label>微信:</label>
                <input name="webchat" type="text" class=" mui-input" data-rule="required;" ng-model="message.webchat"/>
            </div>
            <div style="height: 10px;background: #efeff4;"></div>
            <div class="mui-input-row enter" id="scrolle">
                <label style="width: 35%">云店网址:</label>
                <input name="msg" type="text" class=" mui-input" readonly placeholder="您还没有编码" ng-show="message.agenurl == null"/>
                <a url="{{message.allagenurl}}" style="font-size: 10px;
                    line-height: 40px;
                    height: 40px;
                    overflow: hidden;
                    width: 65%;
                    display: block;
                    white-space:nowrap;
                    text-overflow :ellipsis">
                    {{message.allagenurl}}
                </a>
            </div>
            <div class="mui-input-row">
                <label>编码:</label>
                <input name="agenno" type="text" class=" mui-input" readonly ng-model="message.agenurl" placeholder="请联系分公司获取"/>
            </div>
            <div class="mui-input-row">
                <label>地址:</label>
                <input name="proive" type="text" class="mui-input" readonly="readonly" ng-model="prov"
                       style="width:20%;float: left;padding-left: 1%;padding-right:0.5em;"/>
                <input name="city" type="text" class="mui-input" readonly="readonly" ng-model="cty"
                       style="width:25%;float: left;padding-left: 1%;padding-right:0.5em;"/>
                <input name="xian" type="text" class="mui-input" readonly="readonly" ng-model="xian"
                       style="width:25%;float: left;padding-left: 1%;padding-right:1em;"/>

                <!--<select id='proive' style="width:21%;float: left;padding-left: 5%" ng-change="getcity()" ng-model="prov" >
                    <option ng-repeat=" x in province" value="{{x.id}}">{{x.name}}</option>
                </select>
                <select id='city' style="width:21%;float: left;padding-left: 5%"   ng-change="getxian()"  ng-model="cty">
                    <option value="" selected>请选择</option>

                    <option ng-repeat=" y in city" value="{{y.id}}">{{y.name}}</option>
                </select>
                <select id='xian' style="width:21%;float: left;padding-left: 5%" ng-model="xian">
                    <option value="" selected>请选择</option>

                    <option ng-repeat="z in subcity" value="{{z.id}}">{{z.name}}</option>
                </select>-->
            </div>

            <div style="height: 10px;background: #efeff4;"></div>

            <div class="mui-input-row enter">
                <label>发展人:</label>
                <input name="recommendaccount" type="text" class="mui-input" ng-value="message.recommendaccount"
                       readonly style="color: gray;"/>
            </div>
            <div class="mui-input-row enter">
                <label>姓名:</label>
                <input type="text" class="mui-input" ng-value="message.raname" readonly style="color: gray;"/>
            </div>


            <div style="height: 10px;background: #efeff4;"></div>
            <div class="mui-input-row enter">
                <label style="width: 35%;">上级代理:</label>
                <input name="upagenaccount" type="text" class="mui-input" ng-value="message.upagenaccount" readonly
                       style="color: gray;width: 65%;"/>
            </div>
            <div class="mui-input-row enter">
                <label style="width: 35%;">姓名:</label>
                <input name="upagenaccount" type="text" class="mui-input" ng-value="message.uaname" readonly
                       style="color: gray;width: 65%;"/>
            </div>
        </div>

    </form>
    <div class="mui-content-padded">
        <button id="login" class="mui-btn mui-btn-block mui-btn-danger"
                style="line-height: 1;font-size:15px;padding: 10px;" ng-click="update()">修改
        </button>
    </div>
</div>
<script>
    var app = angular.module('myApp', []);
    app.controller('Ctrl', function ($scope, $http) {
        $http({
            method: 'GET',
            url: "/index.php/Home/Agen/getAgenInfo"
        }).then(function successCallback(response) {
            //console.log(response.data.data);
            $scope.message = response.data.data.message;
            if ($scope.message.agenurl == false) {
                $scope.message.agenurl = '';
            }
            if ($scope.message.name == null) {
                $scope.message.name = '';
            }
            if ($scope.message.webchat == null) {
                $scope.message.webchat = '';
            }
            //储存必须唯一的原信息
            //$scope.message.oldurl = $scope.message.agenurl;
            //$scope.message.oldphone = $scope.message.phone;
            //$scope.message.oldwebchat = $scope.message.webchat;
            //地址
            $scope.province = response.data.data.province;
            $scope.city = response.data.data.city;
            $scope.subcity = response.data.data.area;
            /*$scope.region=response.data.data.message.id_path.split(",");
             $scope.prov=$scope.region[0];
             $scope.cty=$scope.region[1];
             $scope.xian=$scope.region[2];*/
            $scope.addresinfo = response.data.data.addresinfo;
            $scope.prov = $scope.addresinfo[0];
            $scope.cty = $scope.addresinfo[1];
            $scope.xian = $scope.addresinfo[2];
        }, function errorCallback(response) {
        })

        //提交修改
        $scope.update = function () {
            var valida = $('form').trigger("validate").data("validator").isFormValid();//有表单验证的地方用 这个方法
            if (valida) {
                //if($scope.xian == null || $scope.xian == ''){
                $scope.message.newregionid = $scope.message.regionid;
                //} else {
                //    $scope.message.newregionid = $scope.xian;
                //}
                var data = $scope.message;
                http_post($http, "/index.php/Home/Agen/updateAgen", data, "/index.php/Home/Agen/ageninfo");
            }
        }
    })
</script>
</body>
</html>